#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N = 20;
int n, m, k;
int a[N][N];
int col[N];
int cal(int s)
{
    int ret = 0;
    while (s)
    {
        ret++;
        s -= (s & -s);
    }
    return ret;
}
bool cmp(int x, int y)
{
    return x > y;
}
int main()
{
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }
    int ret = 0;
    for (int st = 0; st < (1 << n); st++)
    {
        memset(col, 0, sizeof(col));
        int as = cal(st);
        if (as > k)
            continue;
        int sum = 0;
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                if (st >> i & 1)
                {
                    sum += a[i][j];
                }
                else {
                    col[j] += a[i][j];
                }
            }
        }
        sort(col, col + m, cmp);
        for (int i = 0; i < k - as; i++)
        {
            sum += col[i];
        }
        ret = max(ret, sum);
    }
    cout << ret << endl;
    return 0;
}